﻿#pragma once
#include "SF2Modulator.h"
#include "array/Array.hpp"
#include "collection/ArrayList.hpp"
#include "collection/HashMap.hpp"
#include "yzrutil.h"

namespace yzrilyzr_soundbank{
	EBCLASS(SF2Region){
	public:
	static constexpr int const GENERATOR_STARTADDRSOFFSET=0;
	static constexpr int const GENERATOR_ENDADDRSOFFSET=1;
	static constexpr int const GENERATOR_STARTLOOPADDRSOFFSET=2;
	static constexpr int const GENERATOR_ENDLOOPADDRSOFFSET=3;
	static constexpr int const GENERATOR_STARTADDRSCOARSEOFFSET=4;
	static constexpr int const GENERATOR_MODLFOTOPITCH=5;
	static constexpr int const GENERATOR_VIBLFOTOPITCH=6;
	static constexpr int const GENERATOR_MODENVTOPITCH=7;
	static constexpr int const GENERATOR_INITIALFILTERFC=8;
	static constexpr int const GENERATOR_INITIALFILTERQ=9;
	static constexpr int const GENERATOR_MODLFOTOFILTERFC=10;
	static constexpr int const GENERATOR_MODENVTOFILTERFC=11;
	static constexpr int const GENERATOR_ENDADDRSCOARSEOFFSET=12;
	static constexpr int const GENERATOR_MODLFOTOVOLUME=13;
	static constexpr int const GENERATOR_UNUSED1=14;
	static constexpr int const GENERATOR_CHORUSEFFECTSSEND=15;
	static constexpr int const GENERATOR_REVERBEFFECTSSEND=16;
	static constexpr int const GENERATOR_PAN=17;
	static constexpr int const GENERATOR_UNUSED2=18;
	static constexpr int const GENERATOR_UNUSED3=19;
	static constexpr int const GENERATOR_UNUSED4=20;
	static constexpr int const GENERATOR_DELAYMODLFO=21;
	static constexpr int const GENERATOR_FREQMODLFO=22;
	static constexpr int const GENERATOR_DELAYVIBLFO=23;
	static constexpr int const GENERATOR_FREQVIBLFO=24;
	static constexpr int const GENERATOR_DELAYMODENV=25;
	static constexpr int const GENERATOR_ATTACKMODENV=26;
	static constexpr int const GENERATOR_HOLDMODENV=27;
	static constexpr int const GENERATOR_DECAYMODENV=28;
	static constexpr int const GENERATOR_SUSTAINMODENV=29;
	static constexpr int const GENERATOR_RELEASEMODENV=30;
	static constexpr int const GENERATOR_KEYNUMTOMODENVHOLD=31;
	static constexpr int const GENERATOR_KEYNUMTOMODENVDECAY=32;
	static constexpr int const GENERATOR_DELAYVOLENV=33;
	static constexpr int const GENERATOR_ATTACKVOLENV=34;
	static constexpr int const GENERATOR_HOLDVOLENV=35;
	static constexpr int const GENERATOR_DECAYVOLENV=36;
	static constexpr int const GENERATOR_SUSTAINVOLENV=37;
	static constexpr int const GENERATOR_RELEASEVOLENV=38;
	static constexpr int const GENERATOR_KEYNUMTOVOLENVHOLD=39;
	static constexpr int const GENERATOR_KEYNUMTOVOLENVDECAY=40;
	static constexpr int const GENERATOR_INSTRUMENT=41;
	static constexpr int const GENERATOR_RESERVED1=42;
	static constexpr int const GENERATOR_KEYRANGE=43;
	static constexpr int const GENERATOR_VELRANGE=44;
	static constexpr int const GENERATOR_STARTLOOPADDRSCOARSEOFFSET=45;
	static constexpr int const GENERATOR_KEYNUM=46;
	static constexpr int const GENERATOR_VELOCITY=47;
	static constexpr int const GENERATOR_INITIALATTENUATION=48;
	static constexpr int const GENERATOR_RESERVED2=49;
	static constexpr int const GENERATOR_ENDLOOPADDRSCOARSEOFFSET=50;
	static constexpr int const GENERATOR_COARSETUNE=51;
	static constexpr int const GENERATOR_FINETUNE=52;
	static constexpr int const GENERATOR_SAMPLEID=53;
	static constexpr int const GENERATOR_SAMPLEMODES=54;
	static constexpr int const GENERATOR_RESERVED3=55;
	static constexpr int const GENERATOR_SCALETUNING=56;
	static constexpr int const GENERATOR_EXCLUSIVECLASS=57;
	static constexpr int const GENERATOR_OVERRIDINGROOTKEY=58;
	static constexpr int const GENERATOR_UNUSED5=59;
	static constexpr int const GENERATOR_ENDOPR=60;
	public:
	std::shared_ptr<yzrilyzr_collection::HashMap<int32_t, int16_t>> generators;
	std::shared_ptr<yzrilyzr_collection::ArrayList<std::shared_ptr<SF2Modulator>>> modulators;
	public:
	~SF2Region();
	SF2Region();
	std::shared_ptr<yzrilyzr_collection::HashMap<int32_t, int16_t>> getGenerators();
	std::shared_ptr<yzrilyzr_collection::ArrayList<std::shared_ptr<SF2Modulator>>> getModulators();
	void putShort(int32_t generator, int16_t value);
	yzrilyzr_array::ByteArray * getBytes(int32_t generator);
	int32_t getInteger(int32_t generator);
	int16_t getShort(int32_t generator);
	bool contains(int32_t generator);
	static int16_t getDefaultValue(int32_t generator);
	void putBytes(int32_t generator, yzrilyzr_array::ByteArray & bytes);
	void putInteger(int32_t generator, int32_t value);
	};
}
